package 蓝桥._2024.回文字符串;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
// 1:无需package
// 2: 类名必须Main, 不可修改

public class Main3 {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        //在此输入您的代码...
        int T = scan.nextInt();
        for (int i = 0; i < T; i++) {
            String s = scan.next();

            // 找到字符串从右往左的第一个不是l\q\b的字符
            int r = s.length() - 1;
            while (r >= 0 && (s.charAt(r) == 'l' || s.charAt(r) == 'q' || s.charAt(r) == 'b')) r--;
            int l = 0;
            while(l<s.length() && (s.charAt(l) == 'l' || s.charAt(l) == 'q' || s.charAt(l) == 'b')) l++;

            if(l>=r){
                System.out.println("Yes");
            }else {
                int mid = l + r;
                l = mid/2;
                r = (int)Math.ceil(mid/2.0);
                // 从中间向两边
                while (l>=0 && r<s.length()){
                    if(s.charAt(l)!=s.charAt(r)) {
                        break;
                    }
                    l--;
                    r++;
                }
                if(l>=0)
                    System.out.println("No");
                else
                    System.out.println("Yes");
            }


        }
        scan.close();
    }
}